package com.baosight.sczx.common.zm.cInterface.cl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.spring.SpringApplicationContext;
import com.baosight.iplat4j.dao.Dao;

public class SurveyPonit {
	
	private static Dao dao = (Dao)SpringApplicationContext.getBean("dao");
	
	/**
	 * 查询到被引用安全巡检点的名称
	 * <p>Function: querySurveypointName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-6-30下午   高强
	 * </p>
	 *
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public static EiInfo querySurveypoint(EiInfo info)
	{
		List<Map>  _list = new ArrayList();
		try{
			Map<String, String> para = new HashMap<String, String>();
			para.put("fdSurveyPointInfo", info.getString("fdSurveyPointInfo").toString());
			_list = dao.query("ZMCLSurveyPoint.querySurveyPoint", para);
			info.getBlock(EiConstant.resultBlock).addBlockMeta(initMetaData());
			info.getBlock(EiConstant.resultBlock).setRows(_list);
		}catch(Exception e){
			return info;
		}
		return info;
	}
	
	/**
	 * 构造列
	 * <p>Function: initMetaData</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-6-30下午   高强
	 * </p>
	 *
	 */
	public static EiBlockMeta initMetaData() {
		EiBlockMeta eiMetadata = new EiBlockMeta();
		EiColumn eiColumn;
		eiColumn = new EiColumn("fdKeyId");
		eiColumn.setPrimaryKey(true);
		eiColumn.setFieldLength(32);	
		eiColumn.setDescName("主键");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdSurveypointCode");
		eiColumn.setFieldLength(20);	
		eiColumn.setDescName("巡检点编号");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdSurveypointName");
		eiColumn.setFieldLength(30);	
		eiColumn.setDescName("巡检点名称");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdPosition");
		eiColumn.setFieldLength(200);	
		eiColumn.setDescName("巡检点位置");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdSmartphone");
		eiColumn.setFieldLength(20);	
		eiColumn.setDescName("井下电话");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdStatus");
		eiColumn.setFieldLength(10);	
		eiColumn.setDescName("状态");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdRemark");
		eiColumn.setFieldLength(200);	
		eiColumn.setDescName("备注");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdPathName");
		eiColumn.setFieldLength(50);	
		eiColumn.setDescName("巡检路线名称");
		eiMetadata.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdSurveyPointInfo");
		eiColumn.setFieldLength(230);	
		eiColumn.setDescName("巡检点信息");
		eiMetadata.addMeta(eiColumn);
		
		return eiMetadata;
	}
}
